using System;
using System.Collections.Generic;
using System.Text;
using Decav.Reality;
using Decav.Gatsb.Mobile;

namespace Decav.Gatsb.MobileProviders
{
    /// <summary>
    /// The Sprint service provider for Sprint and Sprint Vision phones.
    /// </summary>
    public class SprintServiceProvider : TelephoneServiceProvider
    {
        public SprintServiceProvider()
            : base("Sprint")
        {
        }

        public override EmailAddress CreateSmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("{0}@messaging.sprintpcs.com", phoneNumber));
        }

        public override EmailAddress CreateMmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("{0}@messaging.sprintpcs.com", phoneNumber));
        }

        public override bool IsProviderMailAddress(string mailAddress)
        {
            if (mailAddress == null)
                throw new ArgumentNullException("mailAddress");

            mailAddress = mailAddress.ToLower();

            if (mailAddress.EndsWith("@messaging.sprintpcs.com")) // SMS, maybe MMS
                return true;

            return false;
        }

        public override IPhoneMessageParser CreateMessageParser()
        {
            return new SprintMessageParser();
        }
    }
}
